build:
	docker build -t ubuntu:20.04mapserv .

mapserver-tutorial.zip:
	wget -c http://download.osgeo.org/mapserver/docs/mapserver-tutorial.zip
data: mapserver-tutorial.zip
	unzip -o mapserver-tutorial.zip
	sed -i '6,7d;5a\  Require all granted' ms4w/httpd.d/httpd_tutorial.conf

run: build data
	docker stop mapserv
	docker rm mapserv
	docker run -d -p8800:80 -v$(shell pwd)/ms4w:/ms4w --restart=always --name mapserv ubuntu:20.04mapserv
	docker cp ms4w/httpd.d/httpd_tutorial.conf mapserv:/etc/apache2/sites-enabled
	docker cp ms4w/Apache/htdocs/mapserver_tutorial.pkg.html mapserv:/var/www/html
	docker stop mapserv
	docker start mapserv

#curl http://127.0.0.1:8800/tutorial/
#curl http://127.0.0.1:8800/tutorial/example1-1.html
